import numpy as np
import cv2 as cv

# 创建3*3照片
img1 = np.zeros((2, 2, 3), np.uint8)
b, g, r = cv.split(img1)

# 图片1 [150 100 10]
b[:] = 150
g[:] = 100
r[:] = 10
img1 = cv.merge([b, g, r])
cv.imshow("img1", img1)


# 创建3*3照片
img2 = np.zeros((3, 3, 3), np.uint8)
b, g, r = cv.split(img2)

# 图片2 [10 100 150]
b[:] = 10
g[:] = 100
r[:] = 150
img2 = cv.merge([b, g, r])
cv.imshow("img2", img2)


# cv.waitKey(0)# 计算图片1+图片2
img_add = cv.add(img1, img2)  # --NG, 大小不同，无法计算
cv.imshow("img_add", img_add)
print("img_add", img_add)

# # 计算图片1-图片2
# img_sub = cv.subtract(img1, img2) --NG

# # 计算图片1*图片2
# img_mul = cv.multiply(img1, img2) --NG

# # 计算图片1/图片2
# img_div = cv.divide(img1, img2) --NG

cv.waitKey(0)
cv.destroyAllWindows()
